<?php get_header(); ?>

<?php //get_template_part('block', 'slider') ?>
<?php
$obj_post = new Azio_Posts();
$array_category_id = array(8, 9, 15, 16);
?>

    <div class="wapper content_general clearfix content_general_add ">
        <div class="left_main1 fl">
            <?php
            foreach ($array_category_id as $category_id):
                $category = get_term($category_id, 'category');
                $category_link = get_term_link($category);
                //var_dump($category);
                $block_posts = Azio_Posts::getPosts(4, $category->cat_id);
                if (!empty($block_posts)) {
                    $post_top = array_shift($block_posts);
                    ?>
                    <div class="index-article clearfix">
                        <h3>
                            <a href="<?php echo $category_link ?>" title="<?php echo esc_attr($category->name) ?>"><?php echo $category->name; ?></a>
                        </h3>

                        <div class="top-article">
                            <a href="<?php echo $post_top->permalink; ?>" title="<?php echo esc_attr($post_top->post_title) ?>">
                                <img src="<?php echo $post_top->featured_image ?>" alt="<?php echo esc_attr($post_top->post_title) ?>" width="325" height="131" class="img-rounded"/>
                            </a>
                            <h4>
                                <a href="<?php echo $post_top->permalink; ?>" title="<?php echo esc_attr($post_top->post_title) ?>"><?php echo $post_top->post_title; ?></a>
                            </h4>
                            <span class="date">(<?php echo $post_top->date ?>) &nbsp;</span>

                            <p><?php echo Azio_Posts::cut_tring_by_char($post_top->excerpt, 240) ?></p>
                        </div>
                        <ul class="side-article">
                            <?php  if (!empty($block_posts))
                                foreach ($block_posts as $block_post):?>
                                    <li>
                                        <a href="<?php echo $block_post->permalink; ?>" title="<?php echo esc_attr($block_post->post_title) ?>">
                                            <img src="<?php echo $block_post->image_avatar ?>" alt="<?php echo esc_attr($block_post->post_title) ?>" width="80" height="80" class="img-rounded"/>
                                            <h4>
                                                <a href="<?php echo $block_post->permalink; ?>" title="<?php echo esc_attr($block_post->post_title) ?>"><?php echo Azio_Posts::cut_tring_by_char($block_post->post_title, 50) ?></a>
                                            </h4>
                                            <span class="date">(<?php echo $block_post->date ?>) &nbsp;</span>

                                            <p><?php echo Azio_Posts::cut_tring_by_char($block_post->excerpt, 100) ?></p>
                                    </li>
                                <?php endforeach; ?>
                        </ul>
                    </div>
                <?php } ?>


            <?php endforeach ?>
        </div>

        <!-- Sidebar-->
        <?php get_sidebar(); ?>
        <!-- / Sidebar-->

    </div>
    <div class="sadow1 wapper"></div>





<?php get_footer(); ?>